using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.IO;

namespace Test.Support {
	class ReInstateNpms {

		static void MainX() {

			DAL dal=new DAL("pon-wpsq21-db07\\in07","npms");



			string[] lines=File.ReadAllLines("c:\\rtf2.txt");

			foreach(string line in lines)
				if(!line.StartsWith("#"))
				{
					string[] arr=line.Split('\t');



					object id=dal.Scalar("select id from RTF where SKUCode='{0}' and tmid={1}",arr[1],arr[0]);
					Console.WriteLine(dal.lastSql);
					Console.WriteLine("spUpdateRTFStatus	'{0}',9",id);
					//Console.WriteLine(dal.NonQry("spUpdateRTFStatus	'{0}',9",id));



					//          object cnt=dal.Scalar("select count(*) from TM ta join SKU s on s.ID=ta.SkuID where TM like '{0}' and SKU ='{1}'",arr[0].PadLeft(8,'0'),arr[1]);
					//          Console.WriteLine(dal.lastSql);
					//          Console.WriteLine("--{0}",cnt);
					//          DataTable tab=dal.Query("select ta.id,Created from TMArchive ta join SKU s on s.ID=ta.SkuID where TM like '{0}' and SKU ='{1}'",arr[0].PadLeft(8,'0'),arr[1]);
					//          Console.WriteLine(dal.lastSql);
					//          Console.WriteLine("--{0},{1}",tab.Rows[0]["id"],tab.Rows[0]["Created"]);
					//          int aff=dal.NonQry(@"insert into tm select [TM],'6',[BookingID],[OptionDetailsID],[SkuID],[Quantity],[Part],[quarantine],[QCPallet],[RemovedQuantity],[Created],
					//[LastUpdated],[STSDecision],[HighBayTypeID],[Weight],[BulkLocated],[ItemInChecking],[STSReference],[LocatedMessageSent],[Owner],[Company],[AutoPalletiserId]
					//from tmarchive where ID={0}",tab.Rows[0]["id"]);
					//          Console.WriteLine(dal.lastSql);
					//          Console.WriteLine("--{0} rows affected",aff);


				}


		}
	}
}
